import { Injectable } from '@angular/core';
import { BaseService } from "../../../core/service/base.service";
import { _HttpClient } from "@delon/theme";
import { Observable } from "rxjs";
import { catchError, tap } from "rxjs/operators";

@Injectable({
  providedIn: 'root'
})
export class DeviceMaintainTaskService extends BaseService{

  getUrl(): string {
    return "api/device-maintain-task";
  }

  constructor(http: _HttpClient) {
    super(http);
  }

  // 获取本月的任务数量
  getMonthTask(): Observable<any> {
    const url = `${this.getUrl()}/month-task`;
    return this.http.get<any>(url).pipe(
      tap(_ => this.log(`fetched object `)),
      catchError(this.handleError<any>(`getany`)),
    );
  }
}
